package com.matrix.gallery.respository

import com.matrix.basecore.net.RetrofitBuilder
import com.matrix.basecore.net.WallpaperResultData
import com.matrix.gallery.ui.wallpaper.apiService.GalleryService
import com.matrix.gallery.ui.wallpaper.bean.PhoneBean
import com.matrix.gallery.ui.wallpaper.bean.PhoneComputerTypeBean
import com.matrix.gallery.ui.wallpaper.bean.WallpaperBean
import okhttp3.ResponseBody
import retrofit2.Call

object WallpaperResp {

    private var mService: GalleryService =
        RetrofitBuilder.initRetrofit().getService(GalleryService::class.java)

    /**
     * 获取手机壁纸
     */
    suspend fun phoneWallpaper(
    ): WallpaperResultData<PhoneComputerTypeBean> {
        return mService.phoneWallpaper(true, 1)
    }

    /**
     * 获取电脑壁纸
     */
    suspend fun computerWallpaper(
    ): WallpaperResultData<PhoneComputerTypeBean> {
        return mService.computerWallpaper(true, 1)
    }

    /**
     * 获取壁纸
     */
    suspend fun getAllWallpaper(
        id: String,
        limit: Int,
        skip: Int,
        adult: Boolean,
        first: Int,
        order: String
    ): WallpaperResultData<PhoneBean> {
        return mService.getPhoneWallpaper(id, limit, skip, adult, first, order)
    }

    /**
     * 获取壁纸
     */
    suspend fun getComputerWallpaper(
        id: String,
        limit: Int,
        skip: Int,
        adult: Boolean,
        first: Int,
        order: String
    ): WallpaperResultData<WallpaperBean> {
        return mService.getComputerWallpaper(id, limit, skip, adult, first, order)
    }

    /**
     * 下载获取壁纸
     */
    suspend fun downloadImage(url: String): Call<ResponseBody> {
        return mService.download(url)
    }

    /**
     * 下载获取壁纸
     */
    fun downloadImages(url: String): Call<ResponseBody> {
        return mService.downloads(url)
    }
}